#include <iostream>
#include <unistd.h>
#include <signal.h>
void printPending(sigset_t pending)
{
    for(int i = 32;i >= 1;i --)
    {
        std::cout << sigismember(&pending, i) ? 1 : 0;
    }
    std::cout << std::endl;
}

 int main()
 {
    sigset_t set, oset;
    sigemptyset(&set);
    sigemptyset(&oset);
    sigaddset(&set, 2);
    sigprocmask(SIG_BLOCK, &set, &oset);
    sigset_t pending;
    while(true)
    {
        sigpending(&pending);
        printPending(pending);
        sleep(1);
    }
    return 0;
 }